slider1:0<0,1,1{curve, s-curve}>curve type
slider2:0<-.99999,.99999,.00001>tension
slider3:0<0,10,0.01>Time

slider5:0<0,1,0.01>In Parametr

slider7:0<0,1,0.0001>In Parametr after Time

slider9:0<0,1,0.0001>Value 1-2

slider10:0<0,1,0.0001>Value 3-4


@init
function curve(index,tension) local(t,x) (
    x = index;
    t = tension;
    (t*x-x) / (2*t*x-t-1);
);
function s_curve(index,tension) local(t,x) (
    index < 0.5 ? (
        x = index;
        t = tension;
        (t*x-x) / (4*t*x-t-1);
    ):(
        x = index-0.5;
        t = -tension*0.5;
        (t*x-x*0.5) / (4*t*x-t-0.5) + 0.5; 
    );
);
function drawpixel(x,y) (
    gfx_x = x;
    gfx_y = y;
    gfx_setpixel(gfx_r,gfx_g,gfx_b);
);
function gfx_setcolor(r, g, b, a) (
    gfx_r = r;
    gfx_g = g;
    gfx_b = b;
    gfx_a = a;
);

//Audio Section
gainMin = 0;
gainMax = 1;

@slider
//Time Section
S2old!=slider5?
(
 flag=1;
 S2old=slider5;
);

//Audio Section
slider9 = min(max(slider9, gainMin), gainMax);



@sample

flag!=0?
(
  delta=(slider5-S2start)/(slider3*srate);
  slider7=slider7+delta;
  (sign(slider5-slider7)!=sign(delta))?
  (
     S2start=slider7=slider5;
     flag=0;
  );
);

//using s-curve on the tension slider to make it easier to dial in variably-squared tensions
tension = 2 * s_curve((slider2+1)/2,.9)-1;
slider9 = slider1 ? s_curve(slider7,slider2) : curve(slider7,slider2);
output = slider9; sliderchange(slider9);
output2 = slider10; sliderchange(slider10);

//Audio Section
levelA = sqrt(slider9); //slider9; 
levelB = sqrt(1-(levelA)^2); //1-levelA;

slider10 = levelB; sliderchange(slider10);

//Do the left mix
spl0 = (spl0 * levelA) + 
       (spl2 * levelB);
    

//Do the right mix
spl1 = (spl1 * levelA) + 
       (spl3 * levelB);



@gfx 300 300

//output
//draw lines
gfx_setcolor(.3,.8,1,1);
i=0;
loop(gfx_w,    
    x1 = gfx_w - i;
    x2 = gfx_w - i-1;
    pos1 = i/gfx_w;    
    pos2 = (i+1)/gfx_w;
    y1 = slider1 ? 
        s_curve(pos1,tension)*gfx_w*(gfx_h/gfx_w): 
        curve(pos1,tension)*gfx_w*(gfx_h/gfx_w);      
    y2 = slider1 ? 
        s_curve(pos2,tension)*gfx_w*(gfx_h/gfx_w): 
        curve(pos2,tension)*gfx_w*(gfx_h/gfx_w);      
    gfx_line(x1,y1,x2,y2,0);
    i+=1;
);
//draw pixels
gfx_setcolor(0,0,0,.5);
i=0;
gfx_circle(0,gfx_h,3);
loop(gfx_w,
    x = gfx_w - i;
    pos = i/gfx_w;
    y = slider1 ? 
        s_curve(pos,tension)*gfx_w*(gfx_h/gfx_w): 
        curve(pos,tension)*gfx_w*(gfx_h/gfx_w);        
    drawpixel(x,y);
    i+=1;  
);

//draw value circle
gfx_setcolor(1,.8,0,1);
x = output*gfx_w;
y = slider1 ? 
    s_curve(1-output,tension)*gfx_h:
    curve(1-output,tension)*gfx_h;
gfx_circle(x,y,4);

//draw value string
string = sprintf(#,"%.3f",output);
gfx_measurestr(string,str_w,str_h);
gfx_x = x-str_w/2;
gfx_y = y-str_h-4-6;
gfx_drawstr(string);



//output2
//draw lines
gfx_setcolor(.3,.8,1,1);
i=0;
loop(gfx_w,    
    x1 = gfx_w - i;
    x2 = gfx_w - i-1;
    pos1 = i/gfx_w;    
    pos2 = (i+1)/gfx_w;
    y1 = slider1 ? 
        s_curve(pos1,tension)*gfx_w*(gfx_h/gfx_w): 
        curve(pos1,tension)*gfx_w*(gfx_h/gfx_w);      
    y2 = slider1 ? 
        s_curve(pos2,tension)*gfx_w*(gfx_h/gfx_w): 
        curve(pos2,tension)*gfx_w*(gfx_h/gfx_w);      
    gfx_line(x1,y1,x2,y2,0);
    i+=1;
);
//draw pixels
gfx_setcolor(0,0,0,.5);
i=0;
gfx_circle(0,gfx_h,3);
loop(gfx_w,
    x = gfx_w - i;
    pos = i/gfx_w;
    y = slider1 ? 
        s_curve(pos,tension)*gfx_w*(gfx_h/gfx_w): 
        curve(pos,tension)*gfx_w*(gfx_h/gfx_w);        
    drawpixel(x,y);
    i+=1;  
);

//draw value circle
gfx_setcolor(1,.8,0,1);
x = output2*gfx_w;
y = slider1 ? 
    s_curve(1-output2,tension)*gfx_h:
    curve(1-output2,tension)*gfx_h;
gfx_circle(x,y,4);

//draw value string
string = sprintf(#,"%.3f",output2);
gfx_measurestr(string,str_w,str_h);
gfx_x = x-str_w/2;
gfx_y = y-str_h-4-6;
gfx_drawstr(string);